<?php
	function insert_host($id,$name){
		db_execute('Insert into plugin_nms_report_host(host_id,report_group)
							values ('.$id.',"'.$name.'")');
	}
	function check_insert_host($id,$name){
		$check = false;
		$result = db_fetch_assoc("SELECT host_id FROM plugin_nms_report_host where host_id=".$id." 
					and report_group='$name'");
		if(!empty($result)){
			$check =true;
		}
		return $check;
	}
	
	function insert_group_interface($id,$name){
		db_execute('Insert into plugin_nms_report_group(interface_group_id,report_group)
							values ('.$id.',"'.$name.'")');
	}
	function check_insert_group($id,$name){
		$check = false;
		$result = db_fetch_assoc("SELECT * FROM plugin_nms_report_group where interface_group_id='$id'
				and report_group='$name'");
				if(!empty($result)){
				$check =true;
				}
				return $check;
	}
	function delete_one_host_report($id,$name){
		db_execute('DELETE FROM plugin_nms_report_host where host_id ='.$id.' and report_group ="'.$name.'"');
	}
	function delete_host_report($name){
		db_execute('DELETE FROM plugin_nms_report_host where report_group ="'.$name.'"');
	}
	function delete_group_report($name){
		db_execute('DELETE FROM plugin_nms_report_group where report_group ="'.$name.'"');
	}
	function delete_one_group_report($name,$group){
		db_execute('DELETE FROM plugin_nms_report_group where interface_group_id = '.$name.' and report_group ="'.$group.'" ');
	}
?>